/** container for all data.
*    This is responsible for creating, storing and destroying data */
#ifndef DATABANK_H
#define DATABANK_H

#include <vector>
#include <list>
#include "common.h"

// Databank.h NEVER includes other files
// All class objects used by the databank must therefore be pointers.
class Player;
class Weapon;
class Background;
class GravitatedList;
class Sprite;
class Shot;
class PhysicsModule;
class Particle;

/** Structure that contains common configuration options for the game */
struct Config {
    int numPlayers;
    int numPlanets;
    int screenWidth;
    int screenHeight;
    double gravitationalConstant;
    
    int playerHealth;
    
    // Options menu stuff
    bool blurParticles;
    bool whiteParticles;
    bool optimizePhysics;
    int physPartitionRes;
};


class DataBank {
    std::vector<Player*> players;
    std::vector<Weapon*> weapons;
    std::list<Shot*> shots;
    std::list<Particle*> parts;
    Background* background;
    PhysicsModule *physics;
    Config configs;
public:
	Sprite *sprites;
    Background* getBackground();
    /** Returns player of the given ID */
    Player* getPlayer(int id);
    int getPlayerAlive(void);
    int getPlayerSize(void) { return players.size(); }
    PhysicsModule *getPhysicsModule();
    std::list<Particle*> *getParticles() { return &parts; }
    std::list<Shot*> *getShots() { return &shots; }
 
    /** returns pointer to the configurations */
    Config* getconfig();
    void saveconfig();
    void loadconfig();
    
    /** fills the initial data in the structure.
    *    Could posibly use a filename as a parameter later. */
    void readData();
    
    void init();
    void clear();
    void newGame(int plc, GameType gt);
    
    /** Stuff that really shouldn't be here, but is anyway */
    Particle *makeParticle(double *pos, double *vel, int color);
    void cleanParticles(void);
    
    Shot *makeShot(Shot *type);
    void interactShots(Player *pl);
    void cleanShots(void);
};

#endif
